bitkeeper revision 1.1421.2.1 (428d0172Mlrhy6MiEsOJ6GtVjT0HPg)
authorakw27@arcadians.cl.cam.ac.uk <akw27@arcadians.cl.cam.ac.uk>
Thu, 19 May 2005 21:13:22 +0000 (21:13 +0000)
committerakw27@arcadians.cl.cam.ac.uk <akw27@arcadians.cl.cam.ac.uk>
Thu, 19 May 2005 21:13:22 +0000 (21:13 +0000)
Little blkif interface and xend fixes to make parallax work again.
Also minor debug printing fix to blktap.

Signed-off-by: andrew.warfield@cl.cam.ac.uk
linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap.h
linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c
linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_datapath.c
linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_userdev.c
tools/python/xen/lowlevel/xu/xu.c
tools/python/xen/xend/Blkctl.py
tools/python/xen/xend/server/blkif.py
xen/include/public/io/domain_controller.h

index a55be6c23e3b2d3c1bf01e1e672deef1ee9cfd2d..dac4b0a6766cc08395cb4f55f770768d0ec75bec 100644 (file)
@@ -246,7 +246,8 @@ irqreturn_t blkif_ptfe_int(int irq, void *dev_id, struct pt_regs *regs);
 extern void blkif_ctrlif_rx(ctrl_msg_t *msg, unsigned long id);
 
 /* debug */
-void print_vm_ring_idxs(void);
+void print_fe_ring_idxs(void);
+void print_be_ring_idxs(void);
         
 #define __BLKINT_H__
 #endif
index 9b6272f369bf128aa348eca8640545bf04426aa8..060c6a2dd28ce58b937ee47c96dd72d19b669f45 100644 (file)
@@ -104,7 +104,7 @@ void blkif_ptfe_create(blkif_be_create_t *create)
 
     if ( (blkif = kmem_cache_alloc(blkif_cachep, GFP_KERNEL)) == NULL )
     {
-        DPRINTK("Could not create blkif: out of memory\n");
+        WPRINTK("Could not create blkif: out of memory\n");
         create->status = BLKIF_BE_STATUS_OUT_OF_MEMORY;
         return;
     }
@@ -122,7 +122,7 @@ void blkif_ptfe_create(blkif_be_create_t *create)
     {
         if ( ((*pblkif)->domid == domid) && ((*pblkif)->handle == handle) )
         {
-            DPRINTK("Could not create blkif: already exists\n");
+            WPRINTK("Could not create blkif: already exists\n");
             create->status = BLKIF_BE_STATUS_INTERFACE_EXISTS;
             kmem_cache_free(blkif_cachep, blkif);
             return;
@@ -189,7 +189,7 @@ void blkif_ptfe_connect(blkif_be_connect_t *connect)
     blkif = blkif_find_by_handle(domid, handle);
     if ( unlikely(blkif == NULL) )
     {
-        DPRINTK("blkif_connect attempted for non-existent blkif (%u,%u)\n", 
+        WPRINTK("blkif_connect attempted for non-existent blkif (%u,%u)\n", 
                 connect->domid, connect->blkif_handle); 
         connect->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
         return;
@@ -253,7 +253,7 @@ int blkif_ptfe_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id)
     blkif = blkif_find_by_handle(domid, handle);
     if ( unlikely(blkif == NULL) )
     {
-        DPRINTK("blkif_disconnect attempted for non-existent blkif"
+        WPRINTK("blkif_disconnect attempted for non-existent blkif"
                 " (%u,%u)\n", disconnect->domid, disconnect->blkif_handle); 
         disconnect->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
         return 1; /* Caller will send response error message. */
@@ -499,3 +499,41 @@ void __init blkif_interface_init(void)
     
     blktap_be_ring.sring = NULL;
 }
+
+
+
+/* Debug : print the current ring indices. */
+
+void print_fe_ring_idxs(void)
+{
+    int i;
+    blkif_t *blkif;
+            
+    WPRINTK("FE Rings: \n---------\n");
+    for ( i = 0; i < BLKIF_HASHSZ; i++) { 
+        blkif = blkif_hash[i];
+        while (blkif != NULL) {
+            if (blkif->status == DISCONNECTED) {
+                WPRINTK("(%2d,%2d) DISCONNECTED\n", 
+                   blkif->domid, blkif->handle);
+            } else if (blkif->status == DISCONNECTING) {
+                WPRINTK("(%2d,%2d) DISCONNECTING\n", 
+                   blkif->domid, blkif->handle);
+            } else if (blkif->blk_ring.sring == NULL) {
+                WPRINTK("(%2d,%2d) CONNECTED, but null sring!\n", 
+                   blkif->domid, blkif->handle);
+            } else {
+                blkif_get(blkif);
+                WPRINTK("(%2d,%2d): req_cons: %2d, rsp_prod_prv: %2d "
+                    "| req_prod: %2d, rsp_prod: %2d\n",
+                    blkif->domid, blkif->handle,
+                    blkif->blk_ring.req_cons,
+                    blkif->blk_ring.rsp_prod_pvt,
+                    blkif->blk_ring.sring->req_prod,
+                    blkif->blk_ring.sring->rsp_prod);
+                blkif_put(blkif);
+            } 
+            blkif = blkif->hash_next;
+        }
+    }
+}        
index a58e49fa09dc70c079805826b182bea1612ccecd..7eebcf120fdf9fadce8ce1c50c720f33e29c0794 100644 (file)
@@ -439,27 +439,8 @@ irqreturn_t blkif_ptbe_int(int irq, void *dev_id,
 
 /* Debug : print the current ring indices. */
 
-void print_vm_ring_idxs(void)
+void print_be_ring_idxs(void)
 {
-    int i;
-    blkif_t *blkif;
-            
-    WPRINTK("FE Rings: \n---------\n");
-    for ( i = 0; i < 50; i++) { 
-        blkif = blkif_find_by_handle((domid_t)i, 0);
-        if (blkif != NULL) {
-            if (blkif->blk_ring.sring != NULL) {
-                WPRINTK("%2d: req_cons: %2d, rsp_prod_prv: %2d "
-                    "| req_prod: %2d, rsp_prod: %2d\n", i, 
-                    blkif->blk_ring.req_cons,
-                    blkif->blk_ring.rsp_prod_pvt,
-                    blkif->blk_ring.sring->req_prod,
-                    blkif->blk_ring.sring->rsp_prod);
-            } else {
-                WPRINTK("%2d: [no device channel yet]\n", i);
-            }
-        }
-    }
     if (blktap_be_ring.sring != NULL) {
         WPRINTK("BE Ring: \n--------\n");
         WPRINTK("BE: rsp_cons: %2d, req_prod_prv: %2d "
index 31d683041775e06d949f51d65b5811bb4be03170..78a487662e3e995b1d770f0cb9e06bdf1c2a713d 100644 (file)
@@ -227,7 +227,8 @@ static int blktap_ioctl(struct inode *inode, struct file *filp,
         }
     case BLKTAP_IOCTL_PRINT_IDXS:
         {
-            print_vm_ring_idxs();
+            print_be_ring_idxs();
+            print_fe_ring_idxs();
             WPRINTK("User Rings: \n-----------\n");
             WPRINTK("UF: rsp_cons: %2d, req_prod_prv: %2d "
                             "| req_prod: %2d, rsp_prod: %2d\n",
index b9f8cee097b6bbe4ec2b4d6ce54c4fc2e51ebb35..c9c5b3873aa954b8f5fd60c22c1aa77a1e609698 100644 (file)
@@ -624,6 +624,7 @@ static PyObject *xu_message_get_payload(PyObject *self, PyObject *args)
         C2P(blkif_be_vbd_create_t, domid,        Int, Long);
         C2P(blkif_be_vbd_create_t, blkif_handle, Int, Long);
         C2P(blkif_be_vbd_create_t, pdevice,      Int, Long);
+        C2P(blkif_be_vbd_create_t, dev_handle,   Int, Long);
         C2P(blkif_be_vbd_create_t, vdevice,      Int, Long);
         C2P(blkif_be_vbd_create_t, readonly,     Int, Long);
         C2P(blkif_be_vbd_create_t, status,       Int, Long);
@@ -843,6 +844,7 @@ static PyObject *xu_message_new(PyObject *self, PyObject *args)
         P2C(blkif_be_vbd_create_t, domid,        u32);
         P2C(blkif_be_vbd_create_t, blkif_handle, u32);
         P2C(blkif_be_vbd_create_t, pdevice,      blkif_pdev_t);
+        P2C(blkif_be_vbd_create_t, dev_handle,   u32);
         P2C(blkif_be_vbd_create_t, vdevice,      blkif_vdev_t);
         P2C(blkif_be_vbd_create_t, readonly,     u16);
         break;
index d90c7ce51df0981487eeab447046543499c728af..1e3fd07fbe8c5d27b3234af1b067086409410607 100644 (file)
@@ -30,7 +30,8 @@ def block(op, type, dets, script=None):
         raise ValueError('Invalid operation:' + op)
 
     # Special case phy devices - they don't require any (un)binding
-    if type == 'phy':
+    # Parallax also doesn't need script-based binding.
+    if (type == 'phy') or (type == 'parallax'):
         return dets
     
     if script is None:
index d894b5a0e70bd52500a399dd7ca1d9d42e377401..ace4c5196173c9c575a28ff5167dc06613b2e945 100755 (executable)
@@ -166,6 +166,7 @@ class BlkDev(Dev):
         self.params = None
         self.node = None
         self.device = None
+        self.dev_handle = 0
         self.start_sector = None
         self.nr_sectors = None
         
@@ -232,12 +233,12 @@ class BlkDev(Dev):
         # NOTE: 
         # This clause is testing code for storage system experiments.
         # Add a new disk type that will just pass an opaque id in the
-        # start_sector and use an experimental device type.
+        # dev_handle and use an experimental device type.
         # Please contact andrew.warfield@cl.cam.ac.uk with any concerns.
         if self.type == 'parallax':
             self.node   = node
             self.device =  61440 # (240,0)
-            self.start_sector = long(self.params)
+            self.dev_handle = long(self.params)
             self.nr_sectors = long(0)
             return
         # done.
@@ -330,6 +331,7 @@ class BlkDev(Dev):
                       { 'domid'        : self.frontendDomain,
                         'blkif_handle' : self.backendId,
                         'pdevice'      : self.device,
+                        'dev_handle'   : self.dev_handle,
                         'vdevice'      : self.vdev,
                         'readonly'     : self.readonly() })
         msg = self.backendChannel.requestResponse(msg)
index a4fdd63ad0029d9ef5b51537599b98dc4fd65b4e..69a8359aa99d87ffe1e0c6b299e1b30bd134fb22 100644 (file)
@@ -280,11 +280,12 @@ typedef struct {
     u16        __pad;
     u32        blkif_handle;  /*  4: ...ditto...                         */
     blkif_pdev_t pdevice;     /*  8 */
-    blkif_vdev_t vdevice;     /* 12: Interface-specific id for this VBD. */
-    u16        readonly;      /* 14: Non-zero -> VBD isn't writable.     */
+    u32        dev_handle;    /* 12: Extended device id field.           */
+    blkif_vdev_t vdevice;     /* 16: Interface-specific id for this VBD. */
+    u16        readonly;      /* 18: Non-zero -> VBD isn't writable.     */
     /* OUT */
-    u32        status;        /* 16 */
-} PACKED blkif_be_vbd_create_t; /* 20 bytes */
+    u32        status;        /* 20 */
+} PACKED blkif_be_vbd_create_t; /* 24 bytes */
 
 /* CMSG_BLKIF_BE_VBD_DESTROY */
 typedef struct {